package sf.database.connection;

import java.sql.Connection;

public class ConnectionHelp {
//    private static boolean druidExist = ClassUtils.isPresent("com.alibaba.druid.pool.DruidPooledConnection", ConnectionHelp.class.getClassLoader());

    /**
     * 还原为原始连接
     * @param wrap
     * @return
     */
    public static Connection getPhysicalConnection(Connection wrap) {
//        if (druidExist) {
//            if (wrap instanceof com.alibaba.druid.pool.DruidPooledConnection) {
//                com.alibaba.druid.pool.DruidPooledConnection dpc = (com.alibaba.druid.pool.DruidPooledConnection) wrap;
//                try {
//                    return dpc.unwrap(Connection.class);
//                } catch (SQLException e) {
//                    throw new RuntimeException(e);
//                }
//            }
//        }
        return wrap;
    }
}
